package com.training.java.core.collections.one;

import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;

public class TreeSetDemo2 {

	public static void main(String[] args) {
		
		Car focus = new Car("Ford","Focus", 2014, "12345");
		Car volt = new Car("Chevy","Volt", 2013, "12345");
		Car cayenne = new Car("Porsche","Cayenne", 2015,"XYZ123");
		Car focus2 = new Car("Ford","Focus", 2014, "12345");
		Car focus3 = new Car("Chevy","Volt", 2013, "12345");
		Car cayenne2 = new Car("Porsche","Cayenne", 2015, "ABC123");
		
		Set<Car> cars = new TreeSet<>();
		
		cars.add(volt);
		cars.add(focus);
		cars.add(focus2);
		cars.add(focus3);
		cars.add(cayenne);
		cars.add(cayenne2);
		
		for(Car car: cars)
		{
			System.out.println("*************");
			System.out.println("Make = " + car.getMake());
			System.out.println("Model = " + car.getModel());
			System.out.println("Year= " + car.getYear());
		}
	}


	}

